package mya.mes.mdc.queries.status;

import mya.common.jpa.context.ServiceContext;
import mya.mes.mdc.model.status.MdcStatusType;

import java.util.List;

public class MdcStatusTypeQuery {

    public static List<MdcStatusType> byMdcTag(ServiceContext context, String mdcTag) throws Exception {

        List<MdcStatusType> list = context.em.createNamedQuery("MdcStatusType.byMdcTag", MdcStatusType.class)
                .setParameter(1, mdcTag)
                //   .setLockMode(LockModeType.PESSIMISTIC_WRITE)
                .getResultList();


        return list;
    }


    public static List<MdcStatusType> loadAll(ServiceContext context) throws Exception {

        List<MdcStatusType> list = context.em.createNamedQuery("MdcStatusType.loadAll", MdcStatusType.class)

                .getResultList();


        return list;
    }
}
